<?php if (!defined('THINK_PATH')) exit();?>
<!DOCTYPE html>
<html>
  <head>
    <title>后台管理系统</title>
    <meta http-equiv="content-type" content="text/html;charset=utf-8">
    <link href="__ROOT__/public/css/admin.css" type="text/css" rel="stylesheet" />
    <script type="text/javascript" src="__ROOT__/library/jquery/jquery-1.4.js"></script>
    <script type="text/javascript">
      //删除分类
      function delType(typeId)
      {
          if(confirm("是否删除该分类及分类下所有新闻？"))
          {
              window.location = "__APP__/Modtype/modtype/typeId/"+typeId;
          }
      }
      var oldTypeName;
      var oldArticleNums;
      var oldTypeId;
      var oldLink;
      //让某一行显示为文本框
      function showText(typeId)
      {
          hideText();
          
          oldTypeId = typeId;
          oldTypeName = $("#td"+typeId+"1").html();
          oldArticleNums = $("#td"+typeId+"2").html();
          oldLink = $("#td"+typeId+"3").html();

          $("#td"+typeId+"0").css("background-color","gray");
          $("#td"+typeId+"1").html("<input type='text' name='typeName' size='10' value='"+oldTypeName+"'>");
          $("#td"+typeId+"2").html("<input type='text' name='articleNums' size='10' value='"+oldArticleNums+"'>");
          $("#td"+typeId+"3").html("<a href='#' onclick='submitForm()'>更新</a>  <a href='#' onclick='hideText()'>取消</a>");
      }
      //点击了取消按扭
      function hideText()
      {
    	  $("#td"+oldTypeId+"0").css("background-color","white");
    	  $("#td"+oldTypeId+"1").html(oldTypeName);
    	  $("#td"+oldTypeId+"2").html(oldArticleNums);
    	  $("#td"+oldTypeId+"3").html(oldLink);
      }
      //点击了更新按扭
      function submitForm()
      {
          //设置表单的提交地址
          document.frm.action = "__APP__/Modtype/update/typeId/"+oldTypeId;
          //让表单提交
          document.frm.submit();
      }
    </script>
  </head>
  <body>
    <!-- 网站的头 -->
   <script type="text/javascript">
  $(document).ready(function(){
	  $("#menuDiv1,#menuDiv2,#menuDiv3,#menuDiv4,#menuDiv5").hover(function(){
		  $(this).css("background-color","#D4D0C8");
		  $(this).find("div").show();
	  },function(){
		  $(this).css("background-color","#E4E9EC");
		  $(this).find("div").hide();
	  });
  }); 
  //退出后台
  function logout()
  {
	  if(confirm("是否退出后台管理系统?"))
	  {
		  window.location = "__APP__/Index/login/act/tuichu.html";
	  }
  }
</script>
<div class="headDiv">
  <div class="headDiv1">www.ttnewS.com</div>
  <div class="headDiv2"><img src="__ROOT__/public/images/image6.gif"></div>
</div>
<div class="headDiv3">&nbsp;</div>
<!-- 导航菜单 -->
<div class="menuDiv">
  <div id="menuDiv1"><a href="#" onclick="logout()">重新登陆</a></div>
  <div id="menuDiv2"><a href="#">新闻管理</a><br>
    <div>
      <a href="__APP__/Addnews/index.html">添加新闻</a><br>
      <a href="__APP__/Modnews/index.html">修改新闻</a>
    </div>
  </div>
  <div id="menuDiv3"><a href="#">分类管理</a><br>
    <div>
      <a href="__APP__/Addtype/index.html">添加分类</a><br>
      <a href="__APP__/Modtype/index.html">修改分类</a>
    </div>
  </div>
  <div id="menuDiv4"><a href="#">用户管理</a><br>
    <div>
      <a href="__APP__/Adduser/index.html">添加用户</a>
    </div>
  </div>
  <div id="menuDiv5"><a href="__APP__/Index/index.html">返回首页</a></div>
</div>   
   <!-- 当前位置 -->
    <div class="locationDiv">&nbsp;: 后台管理 : 修改分类</div>
    <!-- 正文内容 -->
    <div class="mainDiv clear">
      <!-- 左侧树状列表 -->
      <div class="leftDiv">
      <script type=text/javascript src="__ROOT__/library/js/dtree.js"></script>
<script  type=text/javascript> 
  function hello()
  {
    d = new dTree('d');

    d.add(0,-1,'后台管理','');

    d.add(1,0,'重新登陆','javascript:logout()');

    d.add(2,0,'新闻管理','');
    d.add(21,2,'添加新闻','__APP__/Addnews/index.html');
    d.add(22,2,'修改新闻','__APP__/Modnews/index.html');

    d.add(3,0,'分类管理','');
    d.add(31,3,'添加分类','__APP__/Addtype/index.html');
    d.add(32,3,'修改分类','__APP__/Modtype/index.html');

    d.add(4,0,'用户管理','');
    d.add(41,4,'添加用户','__APP__/Adduser/index.html');

    d.add(5,0,'返回首页','__APP__/Index/index.html');

    document.write(d);
  }

  hello();
</script>
      </div>
      <!-- 右侧页面内容 -->
      <div class="rightDiv">
        <br><br><br><br>
        <form name="frm" method="post" action="__APP__/Modtype/update.html">
        <table border="1" align="center" width="600" cellpadding="0" cellspacing="0">
          <tr class="modTypeDiv1">
            <td>类别名称</td>
            <td>新闻数</td>
            <td>&nbsp;</td>
          </tr>
          <?php if(is_array($newsInfo)): $i = 0; $__LIST__ = $newsInfo;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?><tr class="modTypeDiv2" style="background-color:#FFFFFF;">
            <td id="td<?php echo ($v["typeId"]); ?>1" width="200"><?php echo ($v["typeName"]); ?></td>
            <td id="td<?php echo ($v["typeId"]); ?>2" width="200"><?php echo ($v["articleNums"]); ?></td>
            <td id="td<?php echo ($v["typeId"]); ?>3" width="200">
              <a href="#" onclick="showText(<?php echo ($v["typeId"]); ?>)">编辑</a>
              &nbsp;&nbsp;&nbsp;
              <a href="#" onclick="delType(<?php echo ($v["typeId"]); ?>)">删除</a>
            </td>
          </tr><?php endforeach; endif; else: echo "" ;endif; ?>
        </table>
        </form>
      </div>
    </div>
  </body>
</html>